# Figure F1

#####
rm(list=ls(all=TRUE))

library("tidyverse")
library(ggpubr)

#### Dataset Original ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Data Rep")
load("debate_length_coded.Rdata")

## Box plots comparison rate of speech ----

# Pooled 
t.test(words_per_sec ~ gender, data = debate_length_coded)

box_pooled <- ggboxplot(debate_length_coded, x = "gender", y = "words_per_sec", 
                        color = "gender", palette = c("#00AFBB", "#E7B800"),
                        ylab = "Words per Second", xlab = "Gender") 


## By Session

t.test(words_per_sec ~ gender, data = subset(debate_length_coded, debate_length_coded$session == 10))
t.test(words_per_sec ~ gender, data = subset(debate_length_coded, debate_length_coded$session == 488))

box_session <- ggboxplot(debate_length_coded, x = "gender", y = "words_per_sec", 
                         color = "gender", palette = c("#00AFBB", "#E7B800"),
                         ylab = "Words per Second", xlab = "Gender") + 
  facet_wrap(~session)

combined_box <- ggarrange(box_pooled, box_session,
                          # labels = c("Pooled","By Seesion"),
                          ncol = 2, common.legend = T,
                          legend = "bottom")

combined_box

## TABLE F1: Rate of speech by gender ----
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Figures")

ggsave("figureF1.pdf", width = 10, height = 8)

